#被动技能：【无暇恋心】
execute as @a[tag=shanling,scores={skIron_sword0=1..}] at @s rotated ~ 0 positioned ^ ^ ^3 run scoreboard players add @p[distance=0..2.9,gamemode=!spectator] shanling5 1
scoreboard players set @a[tag=shanling,scores={skIron_sword0=1..}] skIron_sword0 0
execute unless entity @e[type=armor_stand,tag=jiaohuan] at @a[tag=shanling] at @a[distance=1..6,scores={shanling5=1},gamemode=!spectator] run particle heart ~ ~0.2 ~ 0.1 0.1 0.1 0.01 1 normal @a[tag=shanling]
execute if entity @e[type=armor_stand,tag=jiaohuan] at @a[scores={shanling5=1}] run particle heart ~ ~0.2 ~ 0.1 0.1 0.1 0.01 1 normal @a

#被动技能：【尘埃消散】
execute as @a[tag=shanling] at @s if entity @a[gamemode=!spectator,distance=0.1..5,scores={shanling5=1}] run effect give @s slowness 1 0 true
execute as @a[tag=shanling] at @s if entity @a[gamemode=!spectator,distance=0.1..12,scores={shanling5=1}] run effect give @s speed 1 0 true

#技能武器：【追随】CD
execute as @a[tag=shanling,scores={skCDJPG=..0}] run function nw:yingxiong/2yingxiong/09shanling/skill/2shijian_cd
#技能武器：【谣传】CD
execute as @a[tag=shanling,scores={skCDPearl=..0}] run function nw:yingxiong/2yingxiong/09shanling/skill/2jinjian_cd

#主动技能：【等价交换】
execute as @a[tag=shanling,scores={skEXBottle=1..}] at @s run function nw:yingxiong/2yingxiong/09shanling/skill/1dazhao
#主动技能：【等价交换】CD
execute as @a[tag=shanling,scores={skCDEXBottle=..0}] at @s run function nw:yingxiong/2yingxiong/09shanling/skill/1dazhao_cd
#主动技能：【等价交换】闪灵离开时消失
execute as @e[type=armor_stand,tag=jiaohuan] at @s unless entity @a[gamemode=!spectator,distance=0..4,tag=shanling] run kill @s
#主动技能：【等价交换】法阵时间耗尽消失
kill @e[type=armor_stand,tag=jiaohuan,scores={skCDEntity=10..}]
#主动技能：【等价交换】特效
execute at @e[type=armor_stand,tag=jiaohuan] run particle sneeze ~ ~ ~ 2 0.2 2 0.01 4 normal @a
#主动技能：【等价交换】边缘范围
execute as @e[type=armor_stand,tag=jiaohuan] at @s run tp @s ~ ~ ~ ~7 ~
execute as @e[type=armor_stand,tag=jiaohuan] at @s rotated ~ 0 positioned ^ ^0.2 ^4 run particle sneeze ~ ~ ~ 0.1 0.1 0.1 0.01 1 normal @a
execute as @e[type=armor_stand,tag=jiaohuan] at @s run tp @s ~ ~ ~ ~7 ~
execute as @e[type=armor_stand,tag=jiaohuan] at @s rotated ~ 0 positioned ^ ^0.2 ^4 run particle sneeze ~ ~ ~ 0.1 0.1 0.1 0.01 1 normal @a
execute as @e[type=armor_stand,tag=jiaohuan] at @s run tp @s ~ ~ ~ ~7 ~
execute as @e[type=armor_stand,tag=jiaohuan] at @s rotated ~ 0 positioned ^ ^0.2 ^4 run particle sneeze ~ ~ ~ 0.1 0.1 0.1 0.01 1 normal @a
execute as @e[type=armor_stand,tag=jiaohuan] at @s run tp @s ~ ~ ~ ~7 ~
execute as @e[type=armor_stand,tag=jiaohuan] at @s rotated ~ 0 positioned ^ ^0.2 ^4 run particle sneeze ~ ~ ~ 0.1 0.1 0.1 0.01 1 normal @a


#主动技能：【等价交换】恢复胸甲
execute as @a[tag=shanling,scores={skCDEXBottle=20}] run clear @s leather_chestplate
execute as @a[tag=shanling,scores={skCDEXBottle=20}] run item replace entity @s armor.chest with minecraft:leather_chestplate{AttributeModifiers: [{Operation: 0, Amount: +3, UUID: [I; 647881174, -60873185, -427756220, -390957700], Slot: chest, AttributeName: "generic.armor", Name: "generic.armor"}], Unbreakable: 1, Enchantments: [{id: "minecraft:projectile_protection", lvl: 2}, {id: "minecraft:fire_protection", lvl: 1}, {id: "minecraft:feather_falling", lvl: 1}, {id: "minecraft:binding_curse", lvl: 1}], display: {color: 11084836}} 1


#主动技能：【等价交换】死亡标题
execute at @e[type=armor_stand,tag=jiaohuan] as @a[scores={shanling5=1},nbt={DeathTime:1s}] run tp @s ~ ~1 ~
execute at @e[type=armor_stand,tag=jiaohuan] as @a[scores={shanling5=1},nbt={DeathTime:1s}] run title @s title [{"text":"我是如此爱你","color":"light_purple","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]
execute at @e[type=armor_stand,tag=jiaohuan] as @a[scores={shanling5=1},nbt={DeathTime:1s}] run title @s subtitle [{"text":"所以我将永远的失去你，我的爱人。","color":"green","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" —shanling","color":"light_purple","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]

#技能武器：石剑【追随】
execute at @e[type=armor_stand,tag=jiaohuan] as @a[distance=0..4,tag=shanling,gamemode=!spectator] if data entity @s Inventory[{Slot:-106b,id:"minecraft:stone_sword",Count:1b}] run effect give @a[scores={shanling5=1..},gamemode=!spectator] instant_damage 1 0
execute at @e[type=armor_stand,tag=jiaohuan] as @a[distance=0..4,tag=shanling,gamemode=!spectator] if data entity @s Inventory[{Slot:-106b,id:"minecraft:stone_sword",Count:1b}] at @a[scores={shanling5=1..},gamemode=!spectator] run particle damage_indicator ~ ~0.5 ~ 0.2 0.2 0.2 0.01 6 normal @a
execute at @e[type=armor_stand,tag=jiaohuan] as @a[distance=0..4,tag=shanling,gamemode=!spectator] if data entity @s Inventory[{Slot:-106b,id:"minecraft:stone_sword",Count:1b}] run scoreboard players remove @a[scores={shanling5=1..},gamemode=!spectator] shanling5 1

execute as @a[tag=shanling] if data entity @s Inventory[{Slot:-106b,id:"minecraft:stone_sword",Count:1b}] at @s run function nw:yingxiong/2yingxiong/09shanling/skill/2shijian

#武器技能：金剑【谣传】
execute at @e[type=armor_stand,tag=jiaohuan] as @a[distance=0..4,tag=shanling,gamemode=!spectator] if data entity @s Inventory[{Slot:-106b,id:"minecraft:golden_sword",Count:1b}] run effect give @a[scores={shanling5=1..},gamemode=!spectator] instant_health 1 0
execute at @e[type=armor_stand,tag=jiaohuan] as @a[distance=0..4,tag=shanling,gamemode=!spectator] if data entity @s Inventory[{Slot:-106b,id:"minecraft:golden_sword",Count:1b}] run scoreboard players remove @a[scores={shanling5=1..},gamemode=!spectator] shanling5 1

execute as @a[tag=shanling] if data entity @s Inventory[{Slot:-106b,id:"minecraft:golden_sword",Count:1b}] at @s run function nw:yingxiong/2yingxiong/09shanling/skill/2jinjian

#被动技能：【王后】
effect give @a[tag=shanling] resistance 999999 1 true
effect give @a[tag=shanling,scores={skCDPlayer=5..}] hunger 3 4 true
scoreboard players reset @a[tag=shanling,scores={skCDPlayer=5..}] skCDPlayer

execute as @a[tag=shanling] run title @s actionbar [{"text":"追随","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDJPG","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 谣传","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDPearl","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 等价交换","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDEXBottle","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]
